<!--processed-->
<link rel="stylesheet" href="/views/resolution/detail2/tmp.css">
<section id="resolution-detail2">
    <div class="breadcrumb fx-row-s">
        <i class="back iconfont icon-fanhui1" id="back"></i>
        <span>Resolution</span>
        <span class="interval">/</span>
        <span>Detail</span>
    </div>
    <div class="feat-grid">
        <div class="row">
            <div class="left col-sm-12">
                <button id="update" class="btn-e mt10">Update</button>
                <section id="left-menu" class="left-menu"></section>
            </div>
            <div class="right col-sm-12">
                <div class="right-title">
                    <strong>How would you like to respond？</strong>
                    <a class="a-link ml10 hide" style="text-decoration: underline;">图片工具</a>
                    <span class="fr" data-name="twoType"></span>
                </div>

                <section id="" class="com-tab">
                    <div class="tab-header">
                        <ul class="header-item">
                            <li data-name="a" class="item-list active">appeal</li>
                            <li data-name="b" class="item-list">refund</li>
                        </ul>
                    </div>
                    <div class="tab-content">
                        <div class="content-list">
                            <div class="right-select">
                                <section data-name="comRadio" id="radio-1" class="com-radio">
                                    <!--选择填充-->
                                </section>
                                <div class="right-control">
                                    <div class="control-text">
                                        <p class="control-label">Fill in the certificate information：</p>
                                        <textarea id="control-edit" class="mt10" placeholder="Please fill in something."></textarea>
                                    </div>
                                    <div class="control-up">
                                        <p class="control-label">To upload attachments：</p>
                                        <label class="btn-file mt10">Click on the upload <input multiple id="file" type="file" class="hide"></label>
                                        <ul class="file">
                                            <!--文件上传渲染列表-->
                                        </ul>
                                    </div>
                                    <div class="control-logistics hide">
                                        <p class="control-label">Shipping method：</p>
                                        <div class="form-group-w7">
                                            <input name="No" type="text" class="form-input mt10" placeholder="Please enter the shipping order number">
                                            <section data-name="logisticsSel" class="com-select mt20">
                                                <div class="sel-item">
                                                    <input class="sel-head" type="text" value="" readonly placeholder="请选择"/>
                                                    <input name="logisticsSel" type="hidden" value="">
                                                    <i class="sel-icon"></i>
                                                </div>
                                                <ul class="sel-content">
                                                    <li data-val="China Post EMS" class="sel-list">China Post EMS</li>
                                                    <li data-val="FedEx" class="sel-list">FedEx</li>
                                                    <li data-val="TNT" class="sel-list">TNT</li>
                                                    <li data-val="UPS" class="sel-list">UPS</li>
                                                    <li data-val="DHLExpress" class="sel-list">DHLExpress</li>
                                                    <li data-val="Toll IPEC" class="sel-list">Toll IPEC</li>
                                                    <li data-val="Four PX Express" class="sel-list">Four PX Express</li>
                                                    <li data-val="FLYT Express" class="sel-list">FLYT Express</li>
                                                    <li data-val="Other" class="sel-list">Other</li>
                                                </ul>
                                                <input type="text" class="form-input mt10 hide" name="logisticsInput" placeholder="输入物流方式">
                                            </section>
                                            <div class="clearfix mt20"><button id="addInfo" class="btn-b fl">Add information</button></div>
                                            <ul class="logistics-item">
                                                <!--物流单号填充-->
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="form-group-w7">
                                        <button class="btn-a fr mt50" id="sendOk">
                                            <i class="send-animate"><span class="send-main"></span></i>
                                            <span class="send-text">OK</span>
                                        </button>
                                    </div>

                                </div>
                            </div>
                        </div>
                        <div class="content-list hide">
                            <div class="right-select">
                                <section data-name="comRadio" id="radio-2" class="com-radio">
                                    <!--label fill-->
                                </section>
                                <div class="right-control">

                                    <div class="control-amount form-group-w1 mt30 hide">
                                        <p class="control-label">The refund amount：(<span id="code-amount"></span>)</p>
                                        <input name="amount" type="text" class="form-input mt10">
                                    </div>
                                    <div class="control-address mt30 hide">
                                        <p class="control-label">Select the address：</p>
                                        <div class="form-group-w7 mt10">
                                            <section data-name="street-back" class="com-select">
                                                <div class="sel-item">
                                                    <input class="sel-head" type="text" value="" readonly placeholder="请选择"/>
                                                    <input name="street-back" type="hidden" value="">
                                                    <i class="sel-icon"></i>
                                                </div>
                                                <ul class="sel-content">
                                                    <li data-val="A" class="sel-list">5th Floor,Block A, XiaMao Commercial Plaza, Baiyun District, Guangzhou, GUANGDONG 510410</li>
                                                </ul>
                                            </section>
                                        </div>
                                    </div>
                                    <div class="control-text hide">
                                        <p class="control-label">Fill in the certificate information：</p>
                                        <textarea id="control-edit2" class="mt10" placeholder="Please fill in something."></textarea>
                                    </div>
                                    <div class="form-group-w7">
                                        <button class="btn-a fr mt50" id="sendOk2">
                                            <i class="send-animate"><span class="send-main"></span></i>
                                            <span class="send-text">OK</span>
                                        </button>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </section>

            </div>
        </div>
    </div>
</section>

<!--渲染模板开始-->
<script type="text/html" id="resolution-detail2-info">
    <ul data-name="menuItem" class="menu-item">
        <li data-name="menuList" class="item-list">
            <div data-name="menuTitle" class="list-title row">
                <div class="col-sm-14">
                    <label><strong>Reason </strong></label>
                    <span class="line-br" style="width:calc(100% - 60px)">{{current_reason}}</span>
                </div>
                <div class="col-sm-10">
                    <label><strong>Case ID </strong></label>
                    <span>{{dispute_id}}</span>
                </div>
            </div>
            <div data-name="menuContent" class="list-content" style="display: block">
                <p class="explain">
                    • You'll need to respond on or before Sunday, {{seller_response_due_date}} China Standard Time, so
                    that we can review your info and resolve this case.
                </p>
                <p class="explain">
                    • The buyer reported that they haven't received their order. Until this case is closed, we've also placed a
                    hold on the transaction amount.
                </p>
                <p class="explain">
                    • The buyer has filed a case with their financial institution for a payment of {{dispute_amount_currency_code + dispute_amount_value}} you received on {{update_date}}. We've opened a case on {{create_date}} so that we can collect more info and resolve this with the
                    buyer's financial institution.
                </p>
            </div>
        </li>
        <li data-name="menuList" class="item-list">
            <div data-name="menuTitle" class="list-title">
                <strong>Case details</strong>
            </div>
            <div data-name="menuContent" class="list-content" style="display: block">
                <div class="row case-line">
                    <div class="col-sm-12">Buyer</div>
                    <div class="col-sm-12">{{details.buyer}}</div>
                </div>
                <div class="row case-line">
                    <div class="col-sm-12">Invoice ID</div>
                    <div class="col-sm-12">{{order_sn}}</div>
                </div>
                <div class="row case-line">
                    <div class="col-sm-12">Transaction amount</div>
                    <div class="col-sm-12">{{transcation_amount_currency_code + transcation_account_value}}</div>
                </div>
                <div class="row case-line">
                    <div class="col-sm-12">Dispute amount</div>
                    <div class="col-sm-12">{{dispute_amount_value}}</div>
                </div>
                <div class="row case-line">
                    <div class="col-sm-12">Transaction ID</div>
                    <div class="col-sm-12">{{details.transaction_id}}</div>
                </div>
                <div class="row case-line">
                    <div class="col-sm-12">Dispute reason</div>
                    <div class="col-sm-12">{{current_reason}}</div>
                </div>
                <div class="row case-line">
                    <div class="col-sm-12">Network station</div>
                    <div class="col-sm-12">{{order_sn_site_name}}</div>
                </div>
                <div class="row case-line" style="color:#ff7631;">
                    <div class="col-sm-12">Return tracking number</div>
                    <div class="col-sm-12">
                        {{each buyer_return_tracking_info as v i}}
                            <div><label>{{v.carrier_name}}</label>&nbsp;-&nbsp;<span>{{v.tracking_number}}</span></div>
                        {{/each}}
                    </div>
                </div>
            </div>
        </li>
        <li data-name="menuList" class="item-list active">
            <div data-name="menuTitle" class="list-title">
                <i></i>
                <strong>Your response</strong>
            </div>
            <div data-name="menuContent" class="list-content" style="display: block">
                <ul class="mt10">
                    {{each response_refund_log as v i}}
                        <li>{{v}}</li>
                    {{/each}}
                </ul>
                {{each response_info_log as v i}}
                    <div class="mt20">
                        <p><strong>Date of submission：</strong></p>
                        <div>{{v.created_at}}</div>
                        <p class="mt10"><strong>Note：</strong></p>
                        <div>{{@v.note}}</div>
                        <p class="mt10"><strong>Tracking：</strong></p>
                        <div>{{@v.tracking_info}}</div>
                        <p class="mt10"><strong>File：</strong></p>
                        <div>{{v.files}}</div>
                    </div>
                {{/each}}
            </div>
        </li>
        <li data-name="menuList" class="item-list">
            <div data-name="menuTitle" class="list-title">
                <i></i>
                <strong>Conversation History</strong>
            </div>
            <div data-name="menuContent" class="list-content">
                {{each messages as v i}}
                    <p><strong>{{v.posted_by}}</strong></p>
                    <p>{{@v.content}}</p>
                    <p class="mt3">{{v.time_posted}}</p>
                <br/>
                {{/each}}
            </div>
        </li>
    </ul>
</script>

<!--right-select -->
<script type="text/html" id="resolution-detail2-radio1">
    {{each evidence_type as v i}}
        <label class="radio-list {{i == 0 ? 'box-add' : ''}}">
            <input name="radio-1" type="radio" {{i == 0 ? 'checked' : ''}} value="{{v}}">
            <i data-name="radioBox" class="radio-box"></i>
            <span>{{v}}</span>
        </label>
    {{/each}}
</script>

<script type="text/html" id="resolution-detail2-radio2">
    {{each claim_type as v i}}
        <label class="radio-list {{i == 0 ? 'box-add' : ''}}">
            <input data-attr="{{v.text_fields}}" name="radio-2" type="radio" {{i == 0 ? 'checked' : ''}} value="{{v.key}}">
            <i data-name="radioBox" class="radio-box"></i>
            <span>{{v.translate}}</span>
        </label>
    {{/each}}
</script>

<script type="text/html" id="resolution-layerLink">
    <section class="box-content">
        <div class="row">
            <div class="col-sm-4">
                <label>ERP订单详情图片：</label>
            </div>
            <div class="col-sm-20">
                <a data-name="orderImg" target="_blank" href="http://api.beta.allindesk.com/api/getErpOrderScreenshotController/getScreenshotByTx?tx=8UC17485904176704">http://api.beta.allindesk.com/api/getErpOrderScreenshotController/getScreenshotByTx?tx=8UC17485904176704</a>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <label>Return Policy：</label>
            </div>
            <div class="col-sm-20">
                <a data-name="returnPolicy"></a>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <label>ERP shipping：</label>
            </div>
            <div class="col-sm-20">
                <a data-name="erpShipping"></a>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <label>tmp：</label>
            </div>
            <div class="col-sm-20">
                <a data-name="tmp"></a>
            </div>
        </div>
    </section>
</script>

<!-- js -->
<script>

    $.extend(window.p,{
        src : [],
        //保存当前case信息
        sendInfo:{},
        //当前选项信息
        reason:null,
        reason2:null,
        quill:null,
        //文件数据
        arrFile:[],
        //物流数据
        arrLogistics:[],
        radio2CheckAttr:{},
        layerLink:null,
    });

    $(function() {

        init();

        function init() {

            //菜单插件初始化
            $("#left-menu").comMenu({
                shrink:true
            });
            //返回
            $(".back").click(function(){
                window.history.go(-1);
            });
            //初始请求
            p.urlPara && requestDetail(p.urlPara);

            //初始化选择控件
            var radioObj1 = $('#radio-1');
            p.reason = radioObj1.comRadio();
            //附加事件调用方法
            radioObj1.on('change',"[name='radio-1']",function(){
                clearToggle();
            });

            //更新
            $("#update").on('click',function(){
                requestDetail(p.urlPara,'update_dispute')
            })

            //物流方式
            $("[data-name='logisticsSel']").comSelect({
                init:true,
                callback:function(val){
                    if(val=='Other'){
                        $("input[name='logisticsInput']").removeClass('hide')
                    }else{
                        $("input[name='logisticsInput']").addClass('hide')
                    }
                }
            });
            //添加物流信息
            $("#addInfo").on('click',function(){
                var number = $("input[name='No']").val();
                var logisticsVal = '';
                var logisticsSel = $("input[name='logisticsSel']").val();
                if(logisticsSel == 'Other'){
                    var tempVal = $("input[name='logisticsInput']").val();
                    if(!tempVal){
                        $.comMessage({
                            type:'prompt',
                            text:'请填写物流名称'
                        });
                        return;
                    }
                    logisticsVal = tempVal;
                    $("input[name='logisticsInput']").val('')
                }else{
                    logisticsVal = logisticsSel;
                }

                if(!number){
                    $.comMessage({
                        type:'prompt',
                        text:'请填写物流单号'
                    });
                    return;
                }
                var temp = '<li class="file-list fx-row-b">' +
                                '<i class="index"></i>' +
                                '<div class="file-text">' +
                                '    <div id="orderNo" class="col-sm-12 line-br"></div>' +
                                '    <div id="orderName" class="col-sm-12 line-br"></div>' +
                                '</div>' +
                                '<i class="file-close">&times;</i>' +
                            '</li>';

                var logObj = $(".logistics-item");
                var obj = $(temp);
                    obj.find('.index').html(Number(logObj.find('.file-list').length) + 1);
                    obj.find("#orderNo").html(number);
                    obj.find("#orderName").html(logisticsVal);
                logObj.append(obj[0].outerHTML);
                p.arrLogistics.push({
                    carrier_name:logisticsVal,
                    tracking_number:number
                })
            })

            //物流删除
            $(".logistics-item").on('click','.file-close',function(index,item){
                var parent = $(this).closest('.file-list');
                p.arrLogistics.splice(parent.index(),1);
                parent.remove();
                $(".logistics-item").find('.file-list').each(function(index,item){
                    $(this).find('.index').html(index+1);
                })
            })

            //提交
            $("#sendOk").on('click',function(){
                send($(this));
            })

            //切换Tab
            $(".com-tab").find('.item-list').on('click',function(){
                var v = $(this).index();
                $(".tab-content").find('.content-list').eq(v).removeClass('hide').siblings('.content-list').addClass('hide');
                $(this).addClass('active').siblings('.item-list').removeClass('active')
            })

            $(".a-link").on('click',function(){
                var dom = $("#resolution-layerLink").html();
                p.layerLink = new ComLayer({
                    dom:dom,
                    title:'Details',
                    width:'800px',
                    okHandler:function(){
                        p.layerLink.close();
                    },
                    callback:function(){
                        var base = app.api('');
                        var orderImg = app.api('/api/getErpOrderScreenshotController/getScreenshotByTx?tx=' + p.sendInfo.details.transaction_id);
                        var returnPolicy = app.api('/img/Return%20Policy.png');
                        var erpShipping = "";
                        var tmp = ""
                    }
                })
            });

            /**
             ** 以下为切换后退款相关
             **/
            var radioObj2 = $("#radio-2");
            $("[data-name='street-back']").comSelect({
                init:true,
            })
            //初始化选择控件
            p.reason2 = radioObj2.comRadio();
            //附加事件调用方法
            radioObj2.on('change',"[name='radio-2']",function(){
                clearToggle2();
            });
            $("#sendOk2").on('click',function(){
                send2($(this));
            });

            $("input[name='amount']").on('input',function(){
                amountAddressToggle($(this));
            })

        }


        //详情
        function requestDetail(val,update){
            var loadObj = null;
            app.ajax({
                type:'get',
                url:app.api("/api/getDispute/" + val + '/'+ (update || '')),
                beforeSend:function(){
                    loadObj = $.load({
                        insert:$("#left-menu"),
                    });
                },
                success:function(res){
                    if(res.code == 0){
                        console.log(res);
                        var info = template('resolution-detail2-info',res.data);
                            $("#left-menu").html(info);
                        var selDom = template('resolution-detail2-radio1',res.data);
                            $("#radio-1").html(selDom);
                        var selDom2 = template('resolution-detail2-radio2',res.data);
                        var radioObj2 = $("#radio-2");
                            radioObj2.html(selDom2);
                            clearToggle2();
                            clearToggle();

                        //状态
                        $("[data-name='twoType']").html(res.data.two_type);
                        $("#code-amount").html(res.data.dispute_amount_currency_code);
                        //保存数据
                        p.sendInfo = res.data;
                        //状态隐藏
                        isHiddenView2();
                    }
                },
                complete:function(){
                    loadObj.close()
                }
            });
        }

        //提交
        function send(that){
            var text = $("#control-edit").val();
            /*if(!text){
                $.comMessage({
                    type:'prompt',
                    text:'请填写文本内容！',
                })
                return;
            }*/
            if(p.arrFile<=0){
                $.comMessage({
                    type:'prompt',
                    text:'请上传附件！',
                })
                return;
            }
            if(p.reason.checked() == 'PROOF_OF_FULFILLMENT' && p.arrLogistics.length<=0){
                $.comMessage({
                    type:'prompt',
                    text:'请添加物流信息'
                });
                return;
            }
            var data = {
                input: {
                    evidence_type:p.reason.checked(),
                    notes:text,//p.quill.container.firstChild.innerHTML,
                    evidence_info: {
                        tracking_info: p.arrLogistics
                    }
                },
                case_id:p.sendInfo.dispute_id,
                disputes_reasons:p.sendInfo.reason,
                site_id:p.sendInfo.site_id,
                files: p.arrFile
            };
            app.ajax({
                type:'post',
                url:app.api('/api/paypal/disputes/provide-evidence/' + para.token),
                data:data,
                beforeSend:function(){
                    that.addClass('active-animate');
                    that.prop("disabled",true);
                },
                success:function(res){
                    if(res.code == 0){
                        //history.go(-1);
                        p.urlPara && requestDetail(p.urlPara);
                    }else{
                        $.comMessage({
                            type:'prompt',
                            text:res.msg,
                        })
                    }
                },
                complete:function(){
                    that.removeClass('active-animate');
                    that.prop("disabled",false);
                }
            });
        }

        //切换清除
        function clearToggle(){
            $("#control-edit").val('');
            $(".file").html('');
            p.arrFile = [];
            $(".logistics-item").html('');
            $("input[name='No']").val('');
            p.arrLogistics = [];
            $(".control-logistics").find(".sel-content").eq(0).find('.sel-list').eq(0).trigger('click');
            $("input[name='logisticsInput']").val('');

            if(p.reason.checked() == 'PROOF_OF_FULFILLMENT'){
                $(".control-logistics").removeClass('hide');
            }else{
                $(".control-logistics").addClass('hide');
            }
        }
        //切换清除
        function clearToggle2(){
            $("#control-edit2").val('');
            $("input[name='amount']").val('');
            //$(".street-back").find('.sel-head').val('');
            var _this = $("#radio-2").find('.box-add').find('input');
            var attrObj = JSON.parse(_this.attr('data-attr'));
                p.radio2CheckAttr = attrObj;

            if(attrObj.text){
                $(".control-text").removeClass('hide')
            }else{
                $(".control-text").addClass('hide')
            }
            if(attrObj.address){
                $(".control-address").removeClass('hide').find('.sel-list').eq(0).trigger('click');
            }else{
                $(".control-address").addClass('hide').find("[name='street-back']").val('');
                //$(".street-back").find('.sel-head').val('');
            }
            if(attrObj.amount){
                $(".control-amount").removeClass('hide')
            }else{
                $(".control-amount").addClass('hide')
            }
        }

        //提交
        function send2(that){
            var text = $("#control-edit2").val();
            var amount = $(".control-amount").find("input[name='amount']").val();
            var code = '';

            if(p.radio2CheckAttr['amount']){
                if(!amount){
                    $.comMessage({
                        type:'prompt',
                        text:'请填写退款金额！',
                    })
                    return;
                }
                code = p.sendInfo.dispute_amount_currency_code;
            }
            app.ajax({
                type:'post',
                url:app.api('/api/acceptClaim'),
                beforeSend:function(){
                    that.addClass('active-animate');
                    that.prop("disabled",true);
                },
                data:{
                    email_cs_admin_id:para.user.email_cs_admin_id,
                    site_id:p.sendInfo.site_id,
                    dispute_id:p.sendInfo.dispute_id,
                    dispute_life_cycle_stage:p.sendInfo.dispute_life_cycle_stage,
                    current_status:p.sendInfo.status,
                    note : text,
                    accept_claim_reason:p.reason2.checked(),
                    order_sn:p.sendInfo.order_sn,
                    shipping_address:$(".control-address").find("[name='street-back']").val(),
                    refund_amount:{
                        currency_code:code,
                        value:amount
                    }
                },

                success:function(res){
                    if(res.code == 0){
                        //history.go(-1)
                        p.urlPara && requestDetail(p.urlPara);
                    }else{
                        $.comMessage({
                            type:'prompt',
                            text:res.msg,
                        })
                    }
                },
                timeout:40000,
                complete:function(){
                    that.removeClass('active-animate');
                    that.prop("disabled",false);
                }
            });
        }

        function amountAddressToggle(that){
            var val = that.val();
            if(Number(val)<Number(p.sendInfo.dispute_amount_value)){
                $(".control-address").removeClass('hide').find('.sel-list').eq(0).trigger('click');
            }else{
                $(".control-address").addClass('hide').find("[name='street-back']").val('');
            }
        }

        function isHiddenView2(){
            if(p.sendInfo.status == 'UNDER_REVIEW' || p.sendInfo.status == 'RESOLVED'){
                $(".right").remove();
            }
            if(p.reason.checked() == 'PROOF_OF_FULFILLMENT'){
                $(".control-logistics").removeClass('hide');
            }
        }

    });

    //上传对象
    var up = {
        initEvent:function(){
            var _this = this;
            $('#file').on('change',function(){
                var that = $(this);
                var mes = _this.readFileRule(that);
                if(!mes){
                    _this.upLoadImg(that);
                }else{
                    if(mes == 'type'){
                        $.comMessage({
                            type:'warning',
                            text:'文件类型错误'
                        });
                    }
                }
            });
            //删除事件
            $('.control-up').on('click','.file-close',function(){
                var parent = $(this).closest('.file-list');
                p.arrFile.splice(parent.index(),1);
                parent.remove();
            });

            //提交事件
            $('.btn').on('click',function(){
                _this.upLoad($("[name='upload[]']"),'')
            })
        },

        //校验格式
        readFileRule: function(file,size,num){
            var fileDom = file[0].files;
            var mes = '';
            for(var i = 0;i<fileDom.length;i++){
                if(size && (fileDom[i].size/1000)>size){
                    mes = 'size';
                    break;
                }else if(!/(jpeg)|(png)|(jpg)|(pdf)$/.test(fileDom[i].type)){
                    mes = 'type';
                    break;
                }
            }
            if(num && fileDom.length+p.arrFile.length > num){
                mes = 'length'
            }
            return mes;
        },

        upLoadImg:function(input){
            var _this = this;
            var fd = new FormData();
            input.each(function(index,item){
                $.each(item.files,function(indexChild,itemChild){
                    fd.append('picture[]',itemChild)
                })
            });
            fd.append('type','paypal_disputes');
            fd.append('item_id',p.sendInfo.dispute_id);
            $.ajax({
                type : 'post',
                url : app.api('/api/storage/oss/upload/' + para.token),
                data : fd,
                cache : false,
                processData : false,
                contentType : false,
                success : function(res){
                    if(res.code == 0){
                        _this.saveImgUrl(res.data,input)
                    }
                },
                error : function(){
                    console.log('err')
                }
            })
        },

        saveImgUrl:function(data,input){
            var str = '';
            var temp = '<li class="file-list fx-row-b">' +
                    '<i class="iconfont icon-file"></i>' +
                    '<div class="file-text line-br"></div>' +
                    '<i class="file-close">&times;</i>' +
                    '</li>';

            $.each(data.file_urls,function(index,item){
                var obj = $(temp);
                var filterItem = item.replace(/http.+\//,'');
                    obj.find('.file-text').html(filterItem);
                    str += obj[0].outerHTML;
                p.arrFile.push(item);
            });
            $(".file").append(str);
            input.val('')
        },

    };
    up.initEvent();

</script>